import { Component, OnInit } from '@angular/core';

interface ItemData {
  id: number;
  name: string;
  age: number;
  address: string;
}

@Component({
  selector: 'app-table',
  templateUrl: './table.component.html',
  styleUrls: ['./table.component.css']
})
export class TableComponent implements OnInit {

  public id: any = ""

  public che: any = true

  constructor() { }

  private listOfDisplayData: ItemData[] = [];
  private listOfAllData: ItemData[] = [];


  // 	当前页面展示数据改变的回调函数
  currentPageDataChange($event: ItemData[]): void {
    this.listOfDisplayData = $event;
    console.log(this.listOfDisplayData)
    this.refreshStatus(this.id);
  }

  // 更新状态
  refreshStatus(id): void {
    console.log("选中了")
    console.log(id)

  }

  ngOnInit(): void {
    for (let i = 0; i < 100; i++) {
      this.listOfAllData.push({
        id: i,
        name: `Edward King ${i}`,
        age: 32,
        address: `London, Park Lane no. ${i}`
      });
    }
  }

}
